/*package lucene;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;


public class Indexer {
	public static void  main(String[] args) throws Exception {
		long startTime = System.currentTimeMillis();
		Indexer index = new Indexer("D:\\Java\\lucene\\TextData\\GEDEIndex", "D:\\Java\\lucene\\TextData\\GEDE");
		int numHit;
		try{
			numHit = index.index(dataPath);
		}finally{
			index.close();
		}
		long endTime = System.currentTimeMillis();
		System.out.println("indexing " + numHit + " files took " + (endTime - startTime) + " milliseconds.");
		
	}
	private IndexWriter writer;
	private static String dataPath;
	
	public Indexer(String indexPath, String dataPath) throws IOException{
		Indexer.dataPath = dataPath;
		Directory directory = FSDirectory.open(new File(indexPath));
		writer = new IndexWriter(directory, new IndexWriterConfig(Version.LUCENE_42, new StandardAnalyzer(Version.LUCENE_42)));
		
	}
	
	public void close(){
		try {
			writer.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public int index(String dataPath) throws Exception{
		File[] files = new File(dataPath).listFiles();
		for(File file : files){
			indexFile(file);
		}
		return writer.numDocs();
	}
	
	@SuppressWarnings("deprecation")
	protected Document getDocument(File file) throws Exception {
		Document doc = new Document();
		doc.add(new Field("contents", new FileReader(file)));
		doc.add(new Field("filename", file.getName(),Field.Store.YES,Field.Index.NOT_ANALYZED));
		doc.add(new Field("filepath", file.getCanonicalPath(),Field.Store.YES,Field.Index.NOT_ANALYZED));
		return doc;
	}
	
	private void indexFile(File file) throws Exception {
		System.out.println("indexing " + file.getCanonicalPath());
		Document document =getDocument(file);
		writer.addDocument(document);
		
	}
}
*/